## 
## DAWG
## 
## file: DAWG/CMakeLists.txt
## date: 06 march 2012
## author: Francis Girard
## 



cmake_minimum_required (VERSION 2.6)
project (dawg)


##
##
##
cmake_policy(SET CMP0015 OLD)


##
## The version number.
##
set (dawg_VERSION_MAJOR 0)
set (dawg_VERSION_MINOR 1)

##
## Release / Debug
##
SET(CMAKE_BUILD_TYPE "Release")

##
## Bin / Lib output paths
##
set(LIBRARY_OUTPUT_PATH ../lib/${CMAKE_BUILD_TYPE})
set(EXECUTABLE_OUTPUT_PATH ../bin/${CMAKE_BUILD_TYPE})

##
## configure a header file to pass some of the CMake settings
## to the source code
##
configure_file (
  "${PROJECT_SOURCE_DIR}/dawgConfig.h.in"
  "${PROJECT_BINARY_DIR}/dawgConfig.h"
)

##
## Add the binary directory tree to the search path for include files
## so that we will find dawgConfig.h
##
include_directories("${PROJECT_BINARY_DIR}")


################################################################################
##                                                                            ##
## DAWG specific precompilation directives                                    ##
##                                                                            ##
################################################################################
IF(CMAKE_SYSTEM MATCHES "Windows*")
add_definitions(-DWIN32)
ENDIF(CMAKE_SYSTEM MATCHES "Windows*")

IF(CMAKE_BUILD_TYPE MATCHES "Debug")
add_definitions(-DDEBUG)
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
add_definitions(-DNDEBUG)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")

##
## When building DLL library on windows
##
IF(CMAKE_SYSTEM MATCHES "Windows*")
add_definitions(-DDO_DAWG_EXPORT_DLL)
ENDIF(CMAKE_SYSTEM MATCHES "Windows*")

################################################################################
##                                                                            ##
## Dawg generator                                                             ##
##                                                                            ##
################################################################################


##add_library (dawggenerator_static STATIC
##             dawg_arr_node.c
##             dawg_arr_unsigned_char.c
##             dawggenerator.cpp
##             sha1.c)
##add_library (dawggenerator_dynamic SHARED
##             dawggenerator.cpp
##             dawg_arr_node.c
##             dawg_arr_unsigned_char.c
##             sha1.c
##             WinDllMain.c)
add_executable (dawggen
                sha1.c
                dawg_rbt.c
                dawg_arr_str.c
		dawg_arr_void_ptr.c
		dawg_arr_unsigned_char.c
		dawg_arr_node.c
                dawg_red_black_tree_ext.c
                dawg_unique_node_set.c
		dawg_gnode.c)
##                dawggenerator.cpp
##                dawg_arr_node.c
##                dawg_arr_unsigned_char.c
##                dawggen.c)


################################################################################
##                                                                            ##
## Dawg                                                                       ##
##                                                                            ##
################################################################################

add_library (dawg_static STATIC
             wordbuf.c
             dawg.c)
add_library (dawg_dynamic SHARED
             wordbuf.c
             dawg.c
             WinDllMain.c)
add_executable (dawgdump
                wordbuf.c
                dawg.c
                dawgdump.c)

